#include "sock_define.h"


extern void ocp_err_out(const char* error_output);

int User_login(int login_fd)
{
	printf("a new client login %d\n", login_fd);
	ssize_t n;
	Message_Login buf_recv;
	Message_Login buf_send;
	
again:
	while( (n = read(login_fd, (void*)&buf_recv, sizeof(buf_recv))) > 0)
	{
		printf("recv: %d \n", buf_recv.id);
		buf_send.result = '1';
		buf_send.id = buf_recv.id;
		write(login_fd,  (void*)&buf_send, sizeof(buf_send));
	}
	if(n<0 && errno == EINTR)
		goto again;
	else if( n < 0)
		ocp_err_out("user_login: read error");
	
}